"""
@Time ： 2021/12/1 17:51
@Auth ： ChenZhangKun
"""
import threading
import time


def sing():
    for i in range(5):
        print("唱歌")
        time.sleep(1)


def dance():
    for i in range(5):
        print("跳舞")
        time.sleep(1)


if __name__ == '__main__':
    t1 = threading.Thread(target=sing)
    t2 = threading.Thread(target=dance)
    # 名称
    print(t1.getName())
    print(t2.getName())
    t1.start()
    t2.start()
    # 主线程会等待子线程是否结束
    # 线程是否还在执行
    while t1.is_alive():
        print("还活着")
        time.sleep(1)
        print("当前运行的线程数为%d" % len(threading.enumerate()))
    print(t1.is_alive())
